import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

import { getDictTypeListApi } from '/@/api/admin/dict';
import { DICT } from '/@/enums/dict';

export const columns: BasicColumn[] = [
  {
    title: '岗位名称',
    dataIndex: 'postName',
    // width: 200,
  },
  {
    title: '岗位编码',
    dataIndex: 'postCode',
    // width: 180,
  },

  {
    title: '创建时间',
    dataIndex: 'createTime',
    // width: 180,
  },
  // {
  //   title: '备注',
  //   dataIndex: 'postDesc',
  // },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'postName',
    label: '岗位名称',
    component: 'Input',
    colProps: { span: 5 },
  },
  // {
  //   field: 'status',
  //   label: '状态',
  //   component: 'Select',
  //   componentProps: {
  //     options: [
  //       { label: '启用', value: '0' },
  //       { label: '停用', value: '1' },
  //     ],
  //   },
  //   colProps: { span: 8 },
  // },
];

export const formSchema: FormSchema[] = [
  {
    field: 'postName',
    label: '岗位名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'postCode',
    label: '岗位编码',
    required: true,
    component: 'Input',
  },
  {
    required: true,
    label: '排序',
    field: 'postSort',
    component: 'InputNumber',
  },
  {
    field: 'postLevel',
    label: '岗位级别',
    component: 'ApiSelect',
    componentProps: {
      allowClear: false,
      api: getDictTypeListApi,
      labelField: 'label',
      valueField: 'intValue',
      params: {
        type: DICT.POST_LEVEL,
      },
      getPopupContainer: () => document.body,
    },
  },

  {
    label: '岗位描述',
    field: 'remark',
    component: 'InputTextArea',
    colProps: { span: 24 },
  },
];
